]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Clean up definition of dragOffsetX, dragOffsetY
authorColin Walters <walters@verbum.org>
Fri, 5 Mar 2010 20:23:42 +0000 (15:23 -0500)
committerColin Walters <walters@verbum.org>
Fri, 5 Mar 2010 20:29:29 +0000 (15:29 -0500)
These variables were computed strangely; through cancellation
they'd end up being negative 1/2 the width/height of the actor,
so just use that directly.

https://bugzilla.gnome.org/show_bug.cgi?id=607821

js/ui/dnd.js

index 9188cadeeb63c2ea8620388d40aebd7ea9210b19..e3596d363a81b92b85423b78e9d103c315c604e8 100644 (file)
@@ -170,8 +170,8 @@ _Draggable.prototype = {
             }
             this._dragOrigParent = undefined;
 
-            this._dragOffsetX = this._dragActor.x - this._dragStartX;
-            this._dragOffsetY = this._dragActor.y - this._dragStartY;
+            this._dragOffsetX = - this._dragActorSource.width / 2;
+            this._dragOffsetY = - this._dragActorSource.height / 2;
         } else {
             this._dragActor = this.actor;
             this._dragActorSource = undefined;
@@ -181,8 +181,8 @@ _Draggable.prototype = {
             this._dragOrigScale = this._dragActor.scale_x;
 
             let [actorStageX, actorStageY] = this.actor.get_transformed_position();
-            this._dragOffsetX = actorStageX - this._dragStartX;
-            this._dragOffsetY = actorStageY - this._dragStartY;
+            this._dragOffsetX = actorStageX - stageX;
+            this._dragOffsetY = actorStageY - stageY;
 
             // Set the actor's scale such that it will keep the same
             // transformed size when it's reparented to the stage